package com.luoluo.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {
    //日期对象转字符串
    public String dateToString(Date date,String pattern){
        return new SimpleDateFormat(pattern).format(date);
    }
    //字符串转日期对象
    public Date stringToDate(String string,String pattern) throws ParseException {
        return new SimpleDateFormat(pattern).parse(string);
    }
}
